using System.Linq;
using Magiq.Query;

namespace Magiq.Providers.Objects
{
    public class QueryInfoQueryStrategy<T, TChild> : IQueryStrategy<TChild>
    {
        private readonly QueryInfo<T, TChild> queryInfo;

        public QueryInfoQueryStrategy(QueryInfo<T, TChild> queryInfo)
        {
            this.queryInfo = queryInfo;
        }

        #region IQueryStrategy<T> Members

        public IQueryable<TChild> Execute()
        {
            return queryInfo.Compiled.AsQueryable();
        }

        #endregion
    }
}